
@php
    use YmPhp\Admin\Services\ModuleServices;
        $depth = $item['depth'] ?? 0;

        $horizontal = config('admin.layout.horizontal_menu');
        $defaultIcon = config('admin.menu.default_icon', 'feather icon-circle');

        $url = $_SERVER['REQUEST_URI'];
        $urlComponents = parse_url($url);
        $parts = explode('/', $urlComponents['path']);
        $urlData = explode('admin', $urlComponents['path'][1]);
@endphp
@if($builder->visible($item))
    @if($item['type'] == 'system')
        @if(empty($item['children']))
            <li class="nav-item " data-name="{!! $item['title'] !!}">
                <a data-id="{{ $item['title'] ?? '' }}" @if(mb_strpos($item['uri'], '://') !== false) target="_blank" @endif
                href="{{ $builder->getUrl($item['uri']) }}"  class="nav-link add-page {!! $builder->isActive($item) ? 'active' : '' !!} {{ $horizontal ? 'dropdown-toggle' : '' }}">
                    {!! str_repeat('&nbsp;', $depth) !!}<i class="fa fa-fw {{ $item['icon'] ?: '' }}"></i>
                    <p> {!! $builder->translate($item['title']) !!}</p>
                </a>
            </li>
        @else
            <li class="nav-item {{ $builder->isActive($item) ? 'menu-open' :  '' }}">
                <a href="javascript:;" data-id="{!! $item['title'] !!}" data-url="{{ $builder->getUrl($item['uri']) }}"
                   class="nav-link add-page {{ $builder->isActive($item) ? 'active' : '' }} ym-menu">
                    {!! str_repeat('&nbsp;', $depth) !!}<i class="fa fa-fw {{ $item['icon'] ?: '' }}"></i>
                    <p>{!! $builder->translate($item['title']) !!}</p>
                </a>
                <div class="sub-nav {{ $horizontal ? 'dropdown-menu' : 'nav-treeview' }}">
                    <div class="sub-nav-main">
                        @foreach ($item['children'] as $child)
                            @php
                                $item['depth'] = $depth + 1;
                            @endphp
                            <h3>{!! $builder->translate($child['title']) !!}</h3>
                            <ul>
                                @if (isset($child['children']))
                                    @foreach ($child['children'] as $grandchild)
                                        <li class=" "><a class="nav-link add-page {{ $builder->isActive($grandchild) ? 'active' : '' }}" data-id="{{ $grandchild['id'] ?? '' }}" data-name="{{ $grandchild['title'] }}" href="{{ $builder->getUrl($grandchild['uri']) }}">{!! $builder->translate($grandchild['title']) !!}</a></li>
                                    @endforeach
                                @else
                                    <li class=" "><a class="nav-link add-page {{ $builder->isActive($child) ? 'active' : '' }}" data-id="{{ $child['id'] ?? '' }}" data-name="{{ $child['title'] }}" href="{{ $builder->getUrl($child['uri']) }}">{!! $builder->translate($child['title']) !!}</a></li>
                                @endif
                            </ul>
                        @endforeach
                    </div>
                </div>
            </li>
        @endif
    @elseif($item['type'] == 'module')
        <div class=" nav-common-module_top"><span>功能模块</span></div>
        @if(!empty($item['children']) && !empty($item['extension']))
            <li class="nav-item {{ $builder->isActive($item) ? 'menu-open' :  '' }}" style="padding-left:0" >
                <a class="nav-link add-page {{ $builder->isActive($item) ? 'active' : '' }} ym-menu" data-menuid="{!! $item['title'] !!}" id="{!! $item['title'] !!}" data-name="{!! $builder->translate($item['title']) !!}" href="javascript:;" style="padding-left:15px;">
                    <span>{!! $builder->translate($item['title']) !!}</span>
                </a>
                <div class="sub-nav {{ $horizontal ? 'dropdown-menu' : 'nav-treeview' }}">
                    <div class="sub-nav-main">
                        @foreach ($item['children'] as $child)
                            @php
                                $item['depth'] = $depth + 1;
                            @endphp
                            <h3>{!! $builder->translate($child['title']) !!}</h3>
                            <ul>
                                @if (isset($child['children']))
                                    @foreach ($child['children'] as $grandchild)
                                        <li class=" "><a class="nav-link add-page {{ $builder->isActive($grandchild) ? 'active' : '' }}" data-id="{{ $grandchild['id'] ?? '' }}" data-name="{{ $grandchild['title'] }}" href="{{ $builder->getUrl($grandchild['uri']) }}">{!! $builder->translate($grandchild['title']) !!}</a></li>
                                    @endforeach
                                @else
                                    <li class=" "><a class="nav-link add-page {{ $builder->isActive($child) ? 'active' : '' }}" data-id="{{ $child['id'] ?? '' }}" data-name="{{ $child['title'] }}" href="{{ $builder->getUrl($child['uri']) }}">{!! $builder->translate($child['title']) !!}</a></li>
                                @endif
                            </ul>
                        @endforeach
                    </div>
                </div>
            </li>
        @endif
        <div class="nav-common-module_bottom"></div>
    @endif
@endif



